package com.neusoft.bo;

import com.neusoft.po.Orders;
import com.neusoft.util.CommonUtil;


public class CreditBO {
	private Integer creditId;
	private String userId;
	private Integer amount;
	private Integer left;
	private Integer type;//获得积分=1,消费积分=2
	private String startTime;
	private String endTime;
	
	//业务封装
	
	//积分获取规则计算
	public int ordersAddCreditRule(Orders order) {
		//获取订单金额,并计算对应积分
		int addAmount = (int) ((order.getOrderTotal()*100)/10);
		return addAmount;
	}
	
	//积分消费规则计算
	//抵扣数额=credit/times
	public Double ordersGetDiscount(int credit,int times) {
		return CommonUtil.toFloat(credit, times);
	}

	
	public Integer getCreditId() {
		return creditId;
	}
	public void setCreditId(Integer creditId) {
		this.creditId = creditId;
	}
	public String getUserId() {
		return userId;
	}
	public void setUserId(String userId) {
		this.userId = userId;
	}
	public Integer getAmount() {
		return amount;
	}
	public void setAmount(Integer amount) {
		this.amount = amount;
	}
	public Integer getLeft() {
		return left;
	}
	public void setLeft(Integer left) {
		this.left = left;
	}
	public Integer getType() {
		return type;
	}
	public void setType(Integer type) {
		this.type = type;
	}
	public String getStartTime() {
		return startTime;
	}
	public void setStartTime(String startTime) {
		this.startTime = startTime;
	}
	public String getEndTime() {
		return endTime;
	}
	public void setEndTime(String endTime) {
		this.endTime = endTime;
	}
}
